package redis.util;

import java.util.HashMap;
import java.util.Map;

/**
 * @author houweitao
 * @date 2016年5月17日下午9:41:55
 */

public class CookieStore {
	private static String str =
//			"_dacevid3=49d7897e.3443.76e3.0b4a.000b1a81d811; _HUPUSSOID=3dab5437-5a6e-4533-9702-dd6f060c1663; __gads=ID=f8d8bba74287bab9:T=1455692568:S=ALNI_MbLOMDpCv_sw35rugMZbBBK-0WKrw; AUM=dguB2Yw1io5CSAPLc7pWUrnHjN5nt-yqlWtWpTno5j7lw; vjuids=5d2e0f145.153c201038f.0.b16cf7db; vjlast=1459248760.1459248760.30; __dacevid3=0xfd1f3600961a7ec7; Hm_lvt_39fc58a7ab8a311f2f6ca4dc1222a96e=1462720561; CNZZDATA30020080=cnzz_eid%3D1205398384-1459231139-http%253A%252F%252Fnba.hupu.com%252F%26ntime%3D1462719745; Hm_lvt_c001b67f70039d825f661bc9fc3a0ac4=1462720558; __utma=1.49388104.1462934507.1462934507.1462934507.1; __utmz=1.1462934507.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _CLT=918ebe7bb324d8673460f7af1d701a5c; u=14535515|5oiR5Y+q6IO95ZG15ZG1|afe8|28240ffa8e8e7aa3a87a55f19ea272e3|8e8e7aa3a87a55f1|5oiR5Y+q6IO95ZG15ZG1; ipfrom=234892ad4189bbe613be74266d488787%09Unknown; ua=91468643; lastvisit=192773%091463500212%09%2Fajax%2Flights.ajax.php%3F; __dacevst=1603de69.729df409|1463502094382; _cnzz_CV30020080=buzi_cookie%7C49d7897e.3443.76e3.0b4a.000b1a81d811%7C-1";
	"_cnzz_CV30020080=buzi_cookie%7C49d7897e.3443.76e3.0b4a.000b1a81d811%7C-1; _dacevid3=49d7897e.3443.76e3.0b4a.000b1a81d811; _HUPUSSOID=3dab5437-5a6e-4533-9702-dd6f060c1663; __gads=ID=f8d8bba74287bab9:T=1455692568:S=ALNI_MbLOMDpCv_sw35rugMZbBBK-0WKrw; AUM=dguB2Yw1io5CSAPLc7pWUrnHjN5nt-yqlWtWpTno5j7lw; vjuids=5d2e0f145.153c201038f.0.b16cf7db; vjlast=1459248760.1459248760.30; CNZZDATA30020080=cnzz_eid%3D952566052-1459239898-http%253A%252F%252Fnba.hupu.com%252F%26ntime%3D1459269436; __dacevid3=0xfd1f3600961a7ec7; Hm_lvt_c001b67f70039d825f661bc9fc3a0ac4=1462720558; __utma=1.49388104.1462934507.1462934507.1462934507.1; __utmz=1.1462934507.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); PHPSESSID=k87mt9594je7rfe65u1kfv2f92; _CLT=918ebe7bb324d8673460f7af1d701a5c; u=15710270|5YWz5rOo6L6+5Lq6|afe8|9858b86dda9b4d71eb24aaeb47b71bce|da9b4d71eb24aaeb|5YWz5rOo6L6+5Lq6; ua=20611088; __dacevst=9a507bc2.efc11c1d|1463389910643; _cnzz_CV30020080=buzi_cookie%7C49d7897e.3443.76e3.0b4a.000b1a81d811%7C-1";

	public static Map<String, String> getCookies() {
		Map<String, String> map = new HashMap<>();

		String[] strs = str.split(";");
		for (String s : strs) {
			// System.out.println(s.trim());
			String[] toAdd = s.trim().split("=");
			map.put(toAdd[0], toAdd[1]);
		}

		// ctrl+shift+j，然后输入document.cookie回车
		return map;
	}

	public static Map<String, String> getCookies(String str) {
		Map<String, String> map = new HashMap<>();

		String[] strs = str.split(";");
		for (String s : strs) {
			// System.out.println(s.trim());
			String[] toAdd = s.trim().split("=");
			map.put(toAdd[0], toAdd[1]);
		}

		// ctrl+shift+j，然后输入document.cookie回车
		return map;
	}
}
